<?php

namespace App\Providers;

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;


class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
        Schema::defaultStringLength(191);
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        View::share('layui_source', 'layuiadmin/');
        // View::share('ace_source', 'ace/');
        View::share('copyright', 'Copyright © 2018-'.date('Y').' www.wy-yun.cn. All Rights Reserved 万有云互联');
        View::share('company_name', '万有云互联');

        Validator::extend('mobile',function($attribute, $value, $parameters, $validator){
            if(preg_match("/^1[345789]\d{9}$/", $value)){
                return true;
            }else{
                return false;
            }
        });
    }
}
